<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <cpn></cpn>
    <cpn></cpn>
    <cpn></cpn>
    <hr>
    <cpn2></cpn2>
</div>

<template id="cpp">
    <div>
        <h2>计数：{{countor}}</h2>
        <button @click="add">+</button>
        <button @click="subtract">-</button>
    </div>
</template>

<script src="../../js/vue.js"></script>

<script>
    /*const obj = {
        countor: 0
    }*/
    Vue.component("cpn", {
        template: "#cpp",
        data() {
            return {
                countor: 0
            }
        },
        methods: {
            add() {
                this.countor ++
            },
            subtract() {
                this.countor --
            }
        }
    })
    const vue = new Vue({
        el: "#app",
        data: {
            message: "Hello vue,你好！"
        },
        methods: {
            
        },
    });
</script>
</body>
</html>